<?php
namespace app\index\controller;
use think\Session;


use app\index\model\Person_info as Person_info;

use app\index\validate\LoginCheck;
use think\Controller;


class Login extends Controller
{

    /*配置公共函数*/

    public function index()
    {
        return $this->view->fetch();
    }    

    public function login(){
        // 检验参数是否正确
	    $validate = new LoginCheck();
	    list($msg,$result)= $validate->goapiCheck();
        //判断是否是是否为 POST 请求 检查是否通过
        if ($msg&&$_POST) { 
            // 检查账号密码是否存在
            list($msg,$result)= Person_info::person_info_check() ;
            if($msg){
                // 开启session
                Session::set('user_id', $result['id']);
                Session::set('user_name', $result['user_name']);
            }
        }
        return returnresult($msg,$result) ;   
    }


}

